import logging
import config

# 处理配置


def _fileDelimiter(file):
    return file.replace('\\', '/')


def _pathDelimiter(path):
    path = _fileDelimiter(path)

    if path.endswith('/'):
        return path
    return path + '/'


def _checkConfig(attribute, name):
    if attribute == None:
        print('配置项不存在，请检查', name)


# 检查配置
_checkConfig(config.WORKSPACE_PATH, 'WORKSPACE_PATH')
_checkConfig(config.DEPLOY_PATH, 'DEPLOY_PATH')
_checkConfig(config.PANDOC_PATH, 'PANDOC_PATH')
_checkConfig(config.HANDBOOK_PATH, 'HANDBOOK_PATH')
_checkConfig(config.REFERENCE_PATH, 'REFERENCE_PATH')

config.WORKSPACE_PATH = _pathDelimiter(config.WORKSPACE_PATH)
config.DEPLOY_PATH = _pathDelimiter(config.DEPLOY_PATH)
config.HANDBOOK_PATH = _pathDelimiter(config.HANDBOOK_PATH)
config.REFERENCE_PATH = _pathDelimiter(config.REFERENCE_PATH)
config.PANDOC_PATH = _fileDelimiter(config.PANDOC_PATH)
